package com.example.springaopdemo.proxy;

public class HouseProxy implements HouseSubject{
    //这是代理类,需要指定谁实现
    private RealHouseKeeper houseKeeper;

    public HouseProxy(RealHouseKeeper houseKeeper) {
        this.houseKeeper = houseKeeper;
    }

    @Override
    public void rent() {
        System.out.println("这里是房产中介,只进行房产代理处理");
        houseKeeper.rent();
        System.out.println("房屋出租完毕,我的代理结束");
    }

    @Override
    public void sale() {
        System.out.println("我是中介,帮忙买房子");
        houseKeeper.sale();
        System.out.println("中介卖掉了");
    }
}
